package com.gz.logistics.adapter;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gz.logistics.R;
import com.gz.logistics.library.pojo.Money;
import java.util.List;

/**
 * author wanner1991
 * 主页订单适配器
 */
public class SumOfMoneyAdapter extends BaseAdapter {
    private static  final String TAG = SumOfMoneyAdapter.class.getSimpleName();
    private List<Money> mDataList;
    private Context mContext;

    public SumOfMoneyAdapter(List<Money> mDataList, Context mContext) {
        this.mDataList = mDataList;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return mDataList.size();
    }

    @Override
    public Object getItem(int i) {
        return mDataList.get(i);
    }

    @Override
    public long getItemId(int i) {

        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null){
            view = LayoutInflater.from(mContext).inflate(R.layout.sumofmoneyitem,null);
            holder = new ViewHolder();
            holder.receive_type = (TextView)view.findViewById(R.id.receive_type);
            holder.tv_yingmoney = (TextView)view.findViewById(R.id.yingmoney);
            holder.tv_shimoney = (TextView)view.findViewById(R.id.shimoney);
            view.setTag(holder);
        }else {
            holder = (ViewHolder) view.getTag();
        }
        Money info = mDataList.get(i);
        holder.receive_type.setText(info.getReceiveType());
        holder.tv_yingmoney.setText(info.getMoney());
        holder.tv_shimoney.setText(info.getReal_money());
        return view;
    }
    private class ViewHolder{
        TextView receive_type;//支付方式
        TextView tv_yingmoney;//应收金额
        TextView tv_shimoney;//实收金额
    }
}
